using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ZoomAndPan
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.comboBox1_SelectedIndexChanged(this, EventArgs.Empty);
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string zoomText = this.comboBox1.Text.Replace('%', ' ');
            float zoomFactor;
            if (float.TryParse(zoomText, out zoomFactor))
            {
                this.canvas1.Zoom = zoomFactor / 100.0f;
                this.comboBox1.Text = String.Format("{0}%", this.canvas1.Zoom * 100.0f);
            }
        }
    }
}